package com.zhangzhan.gulimallauthserver.controller;

import jakarta.servlet.http.HttpSession;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.Objects;

import static com.zhangzhan.gulimallcommcon.constant.AuthConstant.SESSION_USER_INFO_KEY;

/**
 * @author 张一恒
 * @version 1.0
 * @description:
 * @date 2024/6/28 11:57
 */
@Controller
public class JumpController {

    /**
     * 登录后不跳转到登录页面
     *
     * @param
     * @return
     */
    @RequestMapping(value = "/login.html", method = RequestMethod.GET)
    public String noJumpLogin(HttpSession session) {

        Object attribute = session.getAttribute(SESSION_USER_INFO_KEY);
//        Object attribute = null;
        if (Objects.isNull(attribute)){
            return "login";
        }

        return "redirect:http://gulimall.com";
    }

}
